/*
 * @Description: Queue.h
 * @author <秋落风声>
 * @addindex 2024-06-27
 * @Email <907741673@qq.com>
 * @attention： sharing content under the CC BY-NC-SA 4.0 license, please indicate the source.
 */

#include <stdio.h>     //fprint
#include <assert.h>    //assert
#include <stdlib.h>    //malloc ,free
#include <stdbool.h>   //bool->DataType
typedef int QDataType; // Here, the data type stored in the queue is assumed to be an integer (int).队列存储的数据类型假设为整型(int)

typedef struct QueueNode
{
    QDataType data;         // Data field 数据域
    struct QueueNode *next; // Pointer field 指针域
} QNode;                    // Renaming the struct type for brevity. 结构体类型进行重命名，方便阅读

typedef struct Queue
{
    QNode *phead; // Pointer to the head (front) of the queue 头指针（队头）指针
    QNode *ptail; // Pointer to the tail (back) of the queue 尾指针（队尾）指针
    int size;     // To keep track of the queue length 记录队列长度
} Queue;


void queueInit(Queue *q);
void queueDestroy(Queue *q);
void deQueue(Queue *q);
void deleteQueueHead(Queue *q);
void enQueue(Queue *q, QDataType x);
bool queueEmpty(Queue *q);
QDataType QueueBack(Queue *q);
QDataType QueueFront(Queue *q);
int QueueSize(Queue *q);
